/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "SUBSTANTA_ACTIVA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SubstantaActiva.findAll", query = "SELECT s FROM SubstantaActiva s"),
    @NamedQuery(name = "SubstantaActiva.findByIdSubstantaActiva", query = "SELECT s FROM SubstantaActiva s WHERE s.idSubstantaActiva = :idSubstantaActiva"),
    @NamedQuery(name = "SubstantaActiva.findBySubstantaActiva", query = "SELECT s FROM SubstantaActiva s WHERE s.substantaActiva = :substantaActiva")})
public class SubstantaActiva implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_SUBSTANTA_ACTIVA")
    private Integer idSubstantaActiva;
    @Column(name = "SUBSTANTA_ACTIVA")
    private String substantaActiva;
    @OneToMany(mappedBy = "idSustanta")
    private Collection<DetaliiReteta> detaliiRetetaCollection;
    @OneToMany(mappedBy = "idSubstantaActiva")
    private Collection<Medicament> medicamentCollection;

    public SubstantaActiva() {
    }

    public SubstantaActiva(Integer idSubstantaActiva) {
        this.idSubstantaActiva = idSubstantaActiva;
    }

    public Integer getIdSubstantaActiva() {
        return idSubstantaActiva;
    }

    public void setIdSubstantaActiva(Integer idSubstantaActiva) {
        this.idSubstantaActiva = idSubstantaActiva;
    }

    public String getSubstantaActiva() {
        return substantaActiva;
    }

    public void setSubstantaActiva(String substantaActiva) {
        this.substantaActiva = substantaActiva;
    }

    @XmlTransient
    public Collection<DetaliiReteta> getDetaliiRetetaCollection() {
        return detaliiRetetaCollection;
    }

    public void setDetaliiRetetaCollection(Collection<DetaliiReteta> detaliiRetetaCollection) {
        this.detaliiRetetaCollection = detaliiRetetaCollection;
    }

    @XmlTransient
    public Collection<Medicament> getMedicamentCollection() {
        return medicamentCollection;
    }

    public void setMedicamentCollection(Collection<Medicament> medicamentCollection) {
        this.medicamentCollection = medicamentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSubstantaActiva != null ? idSubstantaActiva.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SubstantaActiva)) {
            return false;
        }
        SubstantaActiva other = (SubstantaActiva) object;
        if ((this.idSubstantaActiva == null && other.idSubstantaActiva != null) || (this.idSubstantaActiva != null && !this.idSubstantaActiva.equals(other.idSubstantaActiva))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.SubstantaActiva[ idSubstantaActiva=" + idSubstantaActiva + " ]";
    }
    
}
